package WaiBao;

import java.util.Arrays;

public class WangYuanYuan {
    public static void main(String[] args) {
        String[] name = {"李含瑞(班长)","张易于(团支书)", "小李(学习委员)","李晶荷(文艺委员)", "张碧轩", "张韩云", "李书燕", "李怀伟", "李白崔", "王亚青", "力帆白", "李媛绿",
                "韩庙", "李淑兰", "张硕兰", "李紫雪", "薛书亲", "张春海", "廖宇", "张安山", "李晶泊", "学顾青", "韩静波", "王星宇", "贾宇宁", "闫志广", "张相求", "李寻梦",
                "张幻露", "王媛媛(学生)"};//考生本人: 王媛媛(学生)
        int[] age = {20, 18, 18, 17, 19, 20, 19, 21, 19, 19, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 20, 18, 18, 19};//最后一位：考生年龄:19

        double[] qingchun1 = {64, 72, 79, 84, 77, 79, 70, 89, 81, 90, 91, 87, 85, 70, 65, 68, 99, 99, 96, 80, 92, 91, 95, 65, 75, 74, 94, 74, 88, 94};
        double[] qingchun2 = {80, 85, 74, 76, 88, 97, 98, 61, 70, 60, 90, 77, 66, 85, 65, 64, 76, 69, 66, 98, 72, 71, 95, 86, 75, 88, 84, 64, 80, 98};
        double[] qingchun3 = {90, 69, 84, 95, 76, 69, 78, 69, 80, 80, 93, 87, 85, 65, 65, 68, 69, 96, 96, 93, 92, 81, 65, 95, 76, 84, 73, 71, 89, 95};


        double shuyan1 ;//代表每个学生的总分
        double shuyan2;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            shuyan1 = qingchun1[i] + qingchun2[i] +qingchun3[i];
//            shuyan2= (shuyan1 * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" +shuyan1);
//            System.out.println(name[i] + "的平均分为:" + shuyan2);
//        }



        double baozi1 = 0,baozi2= 0;
        double[] shuchujieguo  = new double[30];
//        for (int i = 0; i < 30; i++) {
//            baozi1 = qingchun1[i] + qingchun2[i] + qingchun3[i];
//            baozi2 = (baozi1* 1.0) / 3;
//            shuchujieguo  [i] =baozi2;
//        }
//
//        for (int i = 0; i <  shuchujieguo  .length - 1; i++) {
//            for (int j = 0; j <  shuchujieguo  .length - i - 1; j++) {
//                if (shuchujieguo  [j] < shuchujieguo  [j + 1]) {
//                    double tep =  shuchujieguo  [j];
//                    shuchujieguo [j] = shuchujieguo [j + 1];
//                    shuchujieguo [j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println( shuchujieguo  [i]);
//        }


        double know1 = 0, know2 = 0,know3 = 0;//计算每门课的平均分
        double can1 = 0, can2 = 0, can3 = 0;//计算每门课标准差
        double need1 = 0, need2 = 0, need3 = 0;//计算每门课中位数
        double he = 0;
        for (int i = 0; i < qingchun1.length; i++) {
            he += qingchun1[i];
        }
        know1 = (he * 1.0) / 30;
        System.out.println("农业设施及环境调控的班级平均分为:" +know1);
        double Sum = 0;
        for (int i = 0; i <qingchun2.length; i++) {
            Sum +=qingchun2[i];
        }
        know2 = (Sum * 1.0) / 30;
        System.out.println("农业设施设计与建造的班级平均分为:" + know2);
        double sum = 0;
        for (int i = 0; i < qingchun3.length; i++) {
            sum +=qingchun3[i];
        }
        know3 = (sum * 1.0) / 30;
        System.out.println("园艺植物设施栽培学的班级平均分为:" + know3);



        double c1 = 0, c2 = 0, c3 = 0;
        for (int i = 0; i <qingchun1.length; i++) {
            c1 += (qingchun1[i] - know1) * (qingchun1[i] - know1);
        }
        can1 = Math.sqrt(c1*1.0/30);
        System.out.println("农业设施及环境调控的班级标准差为:" +  can1);
        for (int i = 0; i <qingchun2.length; i++) {
            c2 += (qingchun2[i] - know2) * (qingchun2[i] -know2);
        }
        can2 = Math.sqrt(c2*1.0/30);
        System.out.println("农业设施设计与建造的班级标准差为:" + can2);

        for (int i = 0; i <qingchun3.length; i++) {
            c3 += (qingchun3[i] - know3) * (qingchun3[i] - know3);
        }
        can3 = Math.sqrt(c3*1.0/30);
        System.out.println("园艺植物设施栽培学的标准差为:" +  can3);
//////
////
//        Arrays.sort(qingchun1);
//        Arrays.sort(qingchun2);
//        Arrays.sort(qingchun3);
//        need1 = (qingchun1[15] + qingchun2[16]) * 1.0 / 2;
//        need2 = (qingchun2[15] +qingchun2[16]) * 1.0 / 2;
//        need3 = (qingchun3[15] +qingchun3[16]) * 1.0 / 2;
//        System.out.println("农业设施及环境调控的中位数为:" +  need1);
//        System.out.println("农业设施设计与制造的中位数为:" + need2);
//        System.out.println("园艺植物设施栽培学的中位数为:" +  need3);






    }
}
